WTL Controls
Back to the WTL Controls Home Page.
BIS_WTL_CONTROLS::CColorBlob Class Reference

A CStatic descendant providing customizable background color and edge style, but no text. More...

#include <ColorBlob.h>

Inheritance diagram for BIS_WTL_CONTROLS::CColorBlob:

Public Member Functions

 CColorBlob () noexcept
 
virtual ~CColorBlob ()
 
void SubclassStatic (HWND hWnd)
 Subclass a control window and create the colored background brush. More...
 
void UnSubclassStatic ()
 Un-subclass the window and release GDI resources. More...
 
void SetBackColor (COLORREF value)
 Specify a new background color. A call to UpdateContent may be required to make the new color visible. More...
 
COLORREF GetBackColor () const
 Default: COLOR_RED. More...
 
void SetEdgeStyle (CEdgeStyle style)
 Specify a new edge style. A call to UpdateContent may be required to make the new color visible. More...
 
CEdgeStyle GetEdgeStyle () const
 Default: CEdgeStyle::esLine. More...
 
void UpdateContent ()
 Wraps calls to Invalidate and UpdateWindow, updating the back buffer and blitting the new content to the window. More...
 

Detailed Description

A CStatic descendant providing customizable background color and edge style, but no text.

This CStatic descendant overrides handles WM_PAINT to provide custom background color and edge style, but it doesn't display text. Custom double-buffering is provided; changes to appearance may not be visible until a repaint is forced by calling UpdateContent (or by separately calling Invalidate and UpdateWindow).

Window edge styles defined with OS constants (e.g, SS_ETCHEDFRAME or WS_MODALFRAME will overwrite edges defined by setting the EdgeStyle property. Use EdgeStyle OR windows styles to define an edge, not both.

Typical usage is depicted below.

CColorBlob Blob1;
Blob1.SubclassStatic(GetDlgItem(IDC_STAT1));
Blob1.SetBackColor(COLOR_RED);
.
.
.
Blob1.UnsubclassStatic(); // when finished using the control (probably in OnEndDialog).

Definition at line 49 of file ColorBlob.h.

Constructor & Destructor Documentation

◆ CColorBlob()

BIS_WTL_CONTROLS::CColorBlob::CColorBlob ( )
noexcept

Definition at line 20 of file ColorBlob.cpp.

◆ ~CColorBlob()

BIS_WTL_CONTROLS::CColorBlob::~CColorBlob ( )
virtual

Definition at line 33 of file ColorBlob.cpp.

Member Function Documentation

◆ SubclassStatic()

void BIS_WTL_CONTROLS::CColorBlob::SubclassStatic ( HWND  hWnd)

Subclass a control window and create the colored background brush.

Parameters
hWndHandle of the control window to subclass.
Return values
void

Definition at line 57 of file ColorBlob.cpp.

◆ UnSubclassStatic()

void BIS_WTL_CONTROLS::CColorBlob::UnSubclassStatic ( )

Un-subclass the window and release GDI resources.

Definition at line 70 of file ColorBlob.cpp.

◆ SetBackColor()

void BIS_WTL_CONTROLS::CColorBlob::SetBackColor ( COLORREF  value)

Specify a new background color. A call to UpdateContent may be required to make the new color visible.

Parameters
valueThe new background color.
Return values
void

Definition at line 107 of file ColorBlob.cpp.

◆ GetBackColor()

COLORREF BIS_WTL_CONTROLS::CColorBlob::GetBackColor ( ) const

Default: COLOR_RED.

Returns the background color.

Return values
COLORREFThe background color.

Definition at line 93 of file ColorBlob.cpp.

◆ SetEdgeStyle()

void BIS_WTL_CONTROLS::CColorBlob::SetEdgeStyle ( CEdgeStyle  style)

Specify a new edge style. A call to UpdateContent may be required to make the new color visible.

Parameters
styleThe new edge style.
Return values
void

Definition at line 135 of file ColorBlob.cpp.

◆ GetEdgeStyle()

CEdgeStyle BIS_WTL_CONTROLS::CColorBlob::GetEdgeStyle ( ) const

Default: CEdgeStyle::esLine.

Return values
CEdgeStyleThe currently selected edge style.

Definition at line 121 of file ColorBlob.cpp.

◆ UpdateContent()

void BIS_WTL_CONTROLS::CColorBlob::UpdateContent ( )

Wraps calls to Invalidate and UpdateWindow, updating the back buffer and blitting the new content to the window.

Definition at line 150 of file ColorBlob.cpp.


The documentation for this class was generated from the following files: